package day7;

import java.util.Scanner;

/**
 * @author oldliu
 * @since 1.0
 */
public class GetScond {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] ar = new int[6];
        System.out.println("输入6个数：");
        for (int i = 0; i < ar.length; i += 1) {
            ar[i] = in.nextInt();
        }
        //求最大
        int max = ar[0];
        for (int i = 0; i < ar.length; i++) {
            if (ar[i] > max) {
                max = ar[i];
            }
        }
        //30，30，30 ，2，6，19，17
        System.out.println("biggest is :" + max);
        int second = max;
        for (int i = 0; i < ar.length; i++) {
            if (max == ar[i]) {
                continue;
            }
            if (second == max) {
                second = ar[i];//第一次找到比最大值小的
                continue;
            }
            if (ar[i] > second && ar[i] < max) {
                second = ar[i];
            }
        }
        if (second == max) {
            System.out.println("大家都一样大，没有第二大");
        } else
            System.out.println("第二大的是：" + second);
    }
}
